﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NGinnBPM.Lib.Messages
{
    public class GenericFailure<T> : ICorrelatedMessage
    {
        public GenericFailure(T original)
        {
            ICorrelatedMessage m = (ICorrelatedMessage)original;
            CorrelationId = m.CorrelationId;

        }

        public GenericFailure(T original, string error)
        {
            ICorrelatedMessage m = (ICorrelatedMessage)original;
            CorrelationId = m.CorrelationId;
            ErrorInfo = error;
        }

        public GenericFailure(T original, Exception error)
        {
            ICorrelatedMessage m = (ICorrelatedMessage)original;
            CorrelationId = m.CorrelationId;
            ErrorInfo = error.ToString();
        }

        public GenericFailure()
        {
        }

        public string CorrelationId { get; set; }
        public string ErrorInfo { get; set; }
    }
}
